﻿/*
///    This file is part of BannerLib4Net.
///
///    BannerLib4Net is free software: you can redistribute it and/or modify
///    it under the terms of the GNU General Public License as published by
///    the Free Software Foundation, either version 3 of the License, or
///    (at your option) any later version.

///    BannerLib4Net is distributed in the hope that it will be useful,
///    but WITHOUT ANY WARRANTY; without even the implied warranty of
///    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
///    GNU General Public License for more details.
///
///    You should have received a copy of the GNU General Public License
///    along with BannerLib4Net.  If not, see <http://www.gnu.org/licenses/>.
*/


using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Web.Mvc;
using BannerLib4Net.Core.Logging;
using BannerLib4Net.Data.Dao;
using BannerLib4Net.Security.Encryption;
using BannerLib4Net.Security.Settings;
using BannerLib4Net.Web.Session;

using BannerLib4Net.Core.Utilities.Configuration;
using BannerLib4Net.Postgresql.Dao;
using BannerLib4Net.SqlServer.Dao;

namespace BannerLib4Net.Web.MVC.Controllers
{
    public abstract class BaseController: Controller
    {
        protected SessionToken SessionToken
        {
            get
            {
                SessionToken retval = null; 

                if(Session["session.token"] != null)
                {
                    retval = Session["session.token"] as SessionToken;
                }
                else
                {
                    retval = new SessionToken();
                }

                return retval;
            }
            set
            {
                Session["session.token"] = value;
            }
        }

        protected ILogger Logger { get; private set; }

      

        protected BaseController()
        {
            InitializeLogging();
        }
        
        private void InitializeLogging()
        {
            Logger = LoggingFactory.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString());
        }
    }
}
